<?php /* Smarty version Smarty3-RC3, created on 2013-10-10 09:57:19
         compiled from ".\templates\garnu.tpl" */ ?>
<?php /*%%SmartyHeaderCode:25439525679ffed1806-96914232%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '3049b51ededd72b6ef6e97f9fd0c04c6a4098daa' => 
    array (
      0 => '.\\templates\\garnu.tpl',
      1 => 1323438188,
    ),
  ),
  'nocache_hash' => '25439525679ffed1806-96914232',
  'function' => 
  array (
  ),
  'has_nocache_code' => false,
)); /*/%%SmartyHeaderCode%%*/?>
<?php if (!is_callable('smarty_function_html_select_date')) include 'D:\Program Files\Apache Software Foundation\Apache2.2\htdocs\sil1\include\Smarty\libs\plugins\function.html_select_date.php';
?><?php $_template = new Smarty_Internal_Template("header.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
 echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>
<script type="text/javascript">

$(document).ready(function()
{
  $('input:visible:enabled:first').focus();
  $('select:visible:enabled:first').focus();
  $(".delete").live('click', function(event)
  {
    $(this).parent().remove();
      change();
  });
});
function addNewRow()
{
  $('#billBook tr:last').after('<tr class="itemForRow"><td><input type="text" name="weightEntered[]" class="weightEntered" onChange="setMyRowValue(this);change(this);" \/><\/td><td><input type="text" name="touchEntered[]" class="touchEntered" onChange="setMyRowValue(this);change(this);"\/><\/td><td><input type="text" name="silverEntered[]" class="silverEntered" onChange="setMyRowValue(this);change(this);"\/><\/td><td><input type="text" name="copperEntered[]" class="copperEntered" onChange="setMyRowValue(this);change(this);" \/><\/td><td><a href="javascript:addNewRow();" class="link" >Add<\/a><\/td><td class="delete">Remove<\/td><\/tr>');
}
function addNewRowLast()
{
  $('#lastAddRow tr:last').after('<tr><td><input type="text" name="text1[]" id="text1" class="text1" \/><\/td><td><input type="text" name="text2[]" class="text2" onChange="calculateSum()" \/><\/td><td><a href="javascript:addNewRowLast();" class="link" >Add<\/a><\/td><td class="delete">Remove<\/td><\/tr>');
}

function setMyRowValue(txtObj)
{
   var row       = $(txtObj).parents('.itemForRow');
   var price     = ((parseFloat(row.find('.weightEntered').val().replace("$",""))) * (parseFloat(row.find('.touchEntered').val()))/100);
   var copp      = ((parseFloat(row.find('.weightEntered').val().replace("$",""))) - price);
   isNaN(price)   ? row.find('.silverEntered').val("") : row.find('.silverEntered').val((price).toFixed(2));
   isNaN(copp)    ? row.find('.copperEntered').val("") : row.find('.copperEntered').val((copp).toFixed(2));
   change();
}
function change()
{
  var createdSilverTot     = 0;
  var createdCopperTot     = 0;
  var createdWeightTot     = 0;
  var totalWeight          = 1;
  var totalWeightTouch     = 1;

   totalWeight      = (($("#totalWeight").val()) * ($("#totalWeightTouch").val())/100);
   totalWeightTouch = (($("#totalWeight").val()) - totalWeight);
   $("#totalSilver").val((totalWeight).toFixed(0));
   $("#totalCopper").val((totalWeightTouch).toFixed(0));


   $('.weightEntered').each(function(i)
   {
     price = $(this).val().replace("$","");
     if (!isNaN(price)) createdWeightTot += Number(price);
   });
   $('.silverEntered').each(function(i)
   {
     price = $(this).val().replace("$","");
     if (!isNaN(price)) createdSilverTot += Number(price);
   });
   $('.copperEntered').each(function(i)
   {
     price = $(this).val().replace("$","");
     if (!isNaN(price)) createdCopperTot += Number(price);
   });
   
   newTouch = createdSilverTot / createdWeightTot * 100;

   $('#createdWeightTot').val((createdWeightTot).toFixed(0));
   $('#newTouch').val((newTouch).toFixed(2));
   $('#createdSilver').val((createdSilverTot).toFixed(0));
   $('#createdCopper').val((createdCopperTot).toFixed(0));
   $('#totalCopperMain').val((createdCopperTot).toFixed(0));
   $('#pendingWeight').val((($('#totalWeight').val()) - createdWeightTot).toFixed(0));
   $('#pendingCopper').val((($('#totalCopper').val()) - ($('#totalCopperMain').val())).toFixed(0));
   $('#pendingSilver').val(($('#totalSilver').val() - $('#createdSilver').val() - ($('#pendingCopper').val()* 3/100)).toFixed(0));

}
function calculateSum()
{
	var totText2 = 0;
	$('.text2').each(function(i)
   { 
     price = $(this).val().replace("$","");
     if (!isNaN(price)) totText2 += Number(price);
   });
   
  $('#totText2').val(totText2);
}

</script>
<form name="form1"  method="post" autocomplete="on">
<p align="center" class="table1" colspan="8">******* Garnu ********</p>	
<div>
<table>
	  <input type="hidden" name="garnuMasterId" value="<?php echo $_smarty_tpl->getVariable('garnuMasterId')->value;?>
"/>
  <tr>&nbsp;Date &nbsp; :  
    <?php echo smarty_function_html_select_date(array('prefix'=>"curDate",'start_year'=>"-2",'end_year'=>"+1",'field_order'=>"DMY",'day_value_format'=>"%02d",'time'=>$_smarty_tpl->getVariable('garnuDateMaster')->value),$_smarty_tpl->smarty,$_smarty_tpl);?>

  </tr><br>
  <tr> &nbsp;Garnu : 
    <input type="text" name="garnuName" value="<?php echo $_smarty_tpl->getVariable('garnuNameMaster')->value;?>
" >
  </tr>
  <tr>
    <td> Weight : 
      <input type="text" name="totalWeight" id="totalWeight" value="<?php echo $_smarty_tpl->getVariable('weightMaster')->value;?>
" onchange="change(this);">
    </td>
    <td> Touch : 
      <input type="text" name="totalWeightTouch" id="totalWeightTouch" value="<?php echo $_smarty_tpl->getVariable('touchMaster')->value;?>
" onchange="change(this);">
    </td>
    <td> Silver : 
      <input type="text"  name="totalSilver" id="totalSilver" value="<?php echo $_smarty_tpl->getVariable('silverMaster')->value;?>
" onchange="change(this);">
    </td>  
    <td> Copper : 
      <input type="text"  name="totalCopper" id="totalCopper" value="<?php echo $_smarty_tpl->getVariable('copperMaster')->value;?>
" onchange="change(this);">
    </td>    
    <td> Return Weignt : 
      <input type="text"  name="returnWeight" value="<?php echo $_smarty_tpl->getVariable('retWeightMaster')->value;?>
">
    </td>       
  </tr>  
</table>
</div>

<center><h2>Silver & copper !</h2></center><br>
<div>
<table width="52%" cellpadding="0" cellspacing="0" border="1" align="center">
  <tr>
    <td>
      <table border="0" id="billBook" align="Left" width="30%">
        <tr class="table1">
          <th>Weight</th>
          <th>Touch</th>
          <th>Silver</th>
          <th>Copper</th>
        </tr>
      <?php unset($_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]);
$_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['name'] = "sec";
$_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['loop'] = is_array($_loop=count($_smarty_tpl->getVariable('garnuarray')->value)) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['show']) {
    $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['loop'];
    if ($_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['total'] == 0)
        $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['show'] = false;
} else
    $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['show']):

            for ($_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['iteration'] = 1;
                 $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['total'];
                 $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['first']      = ($_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['last']       = ($_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']["sec"]['total']);
?>
         <tr class="itemForRow">
           <td><input type="text" name="weightEntered[]" class="weightEntered" value="<?php echo $_smarty_tpl->getVariable('garnuarray')->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec']['index']]['weightEntered'];?>
" onChange="setMyRowValue(this);change(this)" /></td>
           <td><input type="text" name="touchEntered[]"  class="touchEntered"  value="<?php echo $_smarty_tpl->getVariable('garnuarray')->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec']['index']]['touchEntered'];?>
"  onChange="setMyRowValue(this);change(this)"/></td>
           <td><input type="text" name="silverEntered[]" class="silverEntered" value="<?php echo $_smarty_tpl->getVariable('garnuarray')->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec']['index']]['silverEntered'];?>
" /></td>
           <td><input type="text" name="copperEntered[]" class="copperEntered" value="<?php echo $_smarty_tpl->getVariable('garnuarray')->value[$_smarty_tpl->getVariable('smarty')->value['section']['sec']['index']]['copperEntered'];?>
"  /></td>
           <td><a href="javascript:addNewRow();"         class="link">Add</a></td>
           <td class="delete">Remove</td>
          </tr>
      <?php endfor; endif; ?>
        <tr class="itemForRow">
          <td><input type="text" name="weightEntered[]" class="weightEntered" onChange="setMyRowValue(this);change(this)" /></td>
          <td><input type="text" name="touchEntered[]"  class="touchEntered"  onChange="setMyRowValue(this);change(this)" /></td>
          <td><input type="text" name="silverEntered[]" class="silverEntered"  /></td>
          <td><input type="text" name="copperEntered[]" class="copperEntered"  /></td>
          <td><a href="javascript:addNewRow();" class="link">Add</a></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table border="0" align="Left" width="52%">
        <tr class="itemRowForTot">
        	<td> &nbsp;</td>
        	<th align="right" width="110px;">Total</th>
          <th>
          	Weight<br />
          	 <input type="text"   name="createdWeightTot"   id="createdWeightTot"   />
          </th>
          <th>
          	New Touch
          	 <input type="text"   name="newTouch"      id="newTouch"   />
          	</th>
          <th>
            Silver<br />
            <input type="text"   name="createdSilver"   id="createdSilver"   />
            <input type="hidden" name="createdCopper"   id="createdCopper"   />
          </th>
          <th>
            Copper<br />
            <input type="text"   name="totalCopperMain[]" id="totalCopperMain" onChange="change()"/>
          </th>
        </tr>
        <tr>
        	<td> &nbsp;</td>
          <th align="right" width="110px;">Pending</th>
          <th>Weight
               <input type="text"   name="pendingWeight[]"  id="pendingWeight"   onChange="change()"/></th>
          <th>Silver
              <input type="text"   name="pendingSilver[]"   id="pendingSilver"   onChange="change()"/></th>
          <th>Copper
              <input type="text"   name="pendingCopper[]"   id="pendingCopper"   onChange="change()"/></th>
          <th align="right" width="150px;"></th>
        </tr>
        <tr><input type="submit" value="Submit" name="submitBtn" value="<?php if (count($_smarty_tpl->getVariable('garnuarray')->value)>0){?>save<?php }else{ ?>Add<?php }?>"></tr>
      </table>
    </td>
  </tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" align="Left" id="lastAddRow">
  <?php unset($_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]);
$_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['name'] = "secOther";
$_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['loop'] = is_array($_loop=count($_smarty_tpl->getVariable('garnuOtherArray')->value)) ? count($_loop) : max(0, (int)$_loop); unset($_loop);
$_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['show'] = true;
$_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['max'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['loop'];
$_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['step'] = 1;
$_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['start'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['step'] > 0 ? 0 : $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['loop']-1;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['show']) {
    $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['total'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['loop'];
    if ($_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['total'] == 0)
        $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['show'] = false;
} else
    $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['total'] = 0;
if ($_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['show']):

            for ($_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['index'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['start'], $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['iteration'] = 1;
                 $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['iteration'] <= $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['total'];
                 $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['index'] += $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['step'], $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['iteration']++):
$_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['rownum'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['iteration'];
$_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['index_prev'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['index'] - $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['index_next'] = $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['index'] + $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['step'];
$_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['first']      = ($_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['iteration'] == 1);
$_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['last']       = ($_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['iteration'] == $_smarty_tpl->tpl_vars['smarty']->value['section']["secOther"]['total']);
?>
     <tr>
       <td><input type="text" name="text1[]" id="text1" value="<?php echo $_smarty_tpl->getVariable('garnuOtherArray')->value[$_smarty_tpl->getVariable('smarty')->value['section']['secOther']['index']]['text1'];?>
" /></td>
       <td><input type="text" name="text2[]" class="text2" value="<?php echo $_smarty_tpl->getVariable('garnuOtherArray')->value[$_smarty_tpl->getVariable('smarty')->value['section']['secOther']['index']]['text2'];?>
" onChange="calculateSum()" /></td>
       <td><a href="javascript:addNewRowLast();" class="link">Add</a></td>
       <td class="delete">Remove</td>
      </tr>
  <?php endfor; endif; ?>  
  <tr>
    <td><input type="text" name="text1[]" id="text1" class="text1" /></td>
    <td><input type="text" name="text2[]" id="text2" class="text2" onChange="calculateSum()" /></td>
    <td><a href="javascript:addNewRowLast();" class="link">Add</a></td>
  </tr>
</table>
<table width="100%">
 <tr>
  	<td>
  	 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  	 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;
  	  Total : <input type="text" name="totText2" id="totText2" value="<?php echo $_smarty_tpl->getVariable('garnuText2Tot')->value;?>
"/>
  	</td>
  </tr> 
</table>       
</div>
<div></div>
</form>
<script type="text/javascript">
<?php if (count($_smarty_tpl->getVariable('garnuarray')->value)>0){?>
  change();
  setMyRowValue();
<?php }?>
</script>
<?php $_template = new Smarty_Internal_Template("footer.tpl", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
 echo $_template->getRenderedTemplate();?><?php $_template->updateParentVariables(0);?><?php unset($_template);?>